﻿using Pattern21迭代器模式.Interface;
using Pattern21迭代器模式.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern21迭代器模式
{
    internal class Client
    {
        public void Start()
        {
            ConcreteAggregate<string> aggregate = new ConcreteAggregate<string>();
            aggregate.Add("床前明月光");
            aggregate.Add("疑是地上霜");
            aggregate.Add("举头望明月");
            aggregate.Add("低头思故乡");

            IIterator<string> iterator = aggregate.Create();
            while(iterator.HasNext())
            {
                string item = iterator.Next();
                Console.WriteLine(item);
            }
        }
    }
}
